<#include "/common/dialogbox.html">
<@header>
</@header>
<@body>
  <div class="x_content">
	<form class="form-horizontal form-label-left" method="post" action="${ctx}/system/dept/doAdd" id="deptAddForm">
	     <div class="form-group">
			<label class="control-label col-md-2 col-sm-2 col-xs-12">
				部门名称 <span class="required">*</span>
			</label>
			<div class="col-md-9 col-sm-9 col-xs-12">
	      		<input type="text" id="deptName" name="deptName" class="form-control" required placeholder="请输入部门名称">
      		</div>
	     </div>
	     <div class="form-group">
	     	<label  class="control-label col-md-2 col-sm-2 col-xs-12">
	     		部门描述 <span class="required">*</span>
     		</label>
     		<div class="col-md-9 col-sm-9 col-xs-12">
	     		<textarea class="form-control" id="deptDesc" name="deptDesc" rows="3" placeholder="请输入描述，最多300个字符 ..." required></textarea>
	     	</div>
	     </div>
	</form>
</div>
</@body>
<@footer>
<script type="text/javascript">
	function submitHandler() {
		if ($("#deptAddForm").validate().form()) {
			var formData = $("#deptAddForm").serialize();
			$.ajax({
				url : $("#deptAddForm").attr('action'),
				type : 'POST',
				dataType: "json",
				data : formData,
				success : function(data) {
					if (data.code == 200) {
						if (data.msg) {
							parent.layer.msg(data.msg, {
								icon : 1
							});
						} else {
							parent.layer.msg('提交成功', {
								icon : 1
							});
						}
						window.parent.refreshTable();
						parent.layer.closeAll('iframe'); // 关闭当前frame
					} else {
						layer.msg(data.msg, { icon : 2 });
					}
				}
			});
		}
	}
</script>
</@footer>
